﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Common.Model;
using Common.Error;
using OpenAPI.Model.API;
using OpenAPI.IDAL.API;
using OpenAPI.DALFactory.API;

namespace OpenAPI.BLL.API
{
    public class DocumentManager
    {
        private static readonly IDocument dal = DataAccess.CreateDocument();

        /// <summary>
        /// 获取文档
        /// </summary>
        /// <param name="doc_cd"></param>
        /// <returns></returns>
        public static DocumentInfo Get(string doc_cd)
        {
            return dal.Get(doc_cd);
        }

        /// <summary>
        /// 获取文档List
        /// </summary>
        /// <returns></returns>
        public static IList<DocumentInfo> List()
        {
            return dal.List();
        }


        /// <summary>
        /// 新增文档
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool Add(DocumentInfo doc, out ErrorType error)
        {
            return dal.Add(doc, out error);
        }

        /// <summary>
        /// 修改文档
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool Modify(DocumentInfo doc, out ErrorType error)
        {
            return dal.Modify(doc, out error);
        }

        /// <summary>
        /// 删除文档
        /// </summary>
        /// <param name="doc_cd"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool Delete(string doc_cd, out ErrorType error)
        {
            return dal.Delete(doc_cd, out error);
        }


    }//
}//
